/* 
 * File:   ShowTables.cpp
 * Author: vikrantsingh
 * 
 * Created on 1 November, 2013, 7:37 PM
 */

#include "ShowTables.h"
#include "Validation.h"
#include "../Sysfiles/SysCatalog.h"
#include <vector>

ShowTables::ShowTables() {
}

ShowTables::ShowTables(const ShowTables& orig) {
}

ShowTables::~ShowTables() {
}

STATUS_CODE ShowTables::run(QueryStructures *queryStruct) {
    int error = Validation::isValid();
    if (SUCCESS != error) {
        return error;
    }
    SysCatalog cat;
    int err = cat.getAllTables(queryStruct->tableList);
    if (err != SUCCESS)
        return err;
    for (vector<string> ::iterator itr = queryStruct->tableList.begin(); itr != queryStruct->tableList.end(); itr++) {
        cout << *itr << endl;
    }
    cout << "Total Tables:" <<queryStruct->tableList[0]<< queryStruct->tableList.size();
    return SUCCESS;
}